#!/usr/bin/perl
# diskswap.cgi in diskman

require './diskman-lib.pl';

&ReadParse();
$diskindex = $in{'disk'};
if ($diskindex =~ /(\d+)/) {
    $nn = $1;
}
my @disks = new_get_diskinfo();
my $dev = get_disk_dev($nn, @disks);
$err_msg = $diskindex."|".$dev;
#goto ERROR_OUT;
if ($diskindex =~ /(\d+)/) {
    $dnum = $1;
}
$uid = $disks[$nn]->{'spare'};
#goto ERROR_OUT;
if( $uid =~ /Y/ ) {

    system("/bin/bcadm -M -rgs -d $dev");
}
else{
    system("/bin/bcadm -M -ags -d $dev");

}

&redirect("index.cgi");
return;

ERROR_OUT:
&error_setup($text{'crt_err_title'});
&error($err_msg);
